package com.aerfazhe.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.RepositoryType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author：wk
 * @Create：2022/4/10/11:17
 * @Description：TODO
 * @Version：1.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    private final static String STOCK_URL = "http://localhost:8082/stock/reduct";

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/add")
    public String add() {
        System.out.println("下单成功");
        String msg = restTemplate.getForObject(STOCK_URL, String.class);
        return "下单成功---"+msg;
    }


    @GetMapping("/findAll")
    public String findAll() {
        System.out.println("查询所有！");
        return "查询所有！";
    }

}
